@import "./../theme";
@import "./../var";
@import "./widget-vars";

$widget-form-container-space: 0.625rem;
$widget-form-container-shadow: none;

.widget-form-container {
  position: absolute;
  overflow-x: hidden;

  .form-empty {
    position: absolute;
    height: 380px;
    width: 240px;
    top: 0;
    left: 50%;
    margin-left: -120px;
    z-index: 99;

    .empty-image {
      background: url("./../../images/form_design_empty.png");
      background-repeat: no-repeat;
      background-position: center;
      background-size: contain;
      width: 10rem;
      height: 10rem;
    }

    .empty-content {
      font-size: $fontSizeLarge;
      color: $colorTextSecondary;
    }

    .el-empty__description {
      margin-top: 0.8rem;
    }
  }

  .widget-form-wrapper {
    min-height: 100%;
    height: 100%;
    background: $bgColorPrimary;
    position: relative;

    .form-design-container {
      height: 100%;
      padding: 10px;
    }

    & > .form-empty {
      height: 100%;
    }
  }

  .widget-form-header {
    height: 150px !important;
    background-position: right;
    background-repeat: no-repeat;
    background-size: cover;
    display: flex;
    flex-direction: column;
    justify-content: center;

    .widget-form-title {
      width: 100%;
      color: $colorTextInverse;
      font-size: $fontSizeSuperLarge;
      padding: 0 2rem;
      font-weight: bold;
      word-break: break-all;
      line-break: anywhere;
    }

    .widget-form-sub-title {
      width: 100%;
      color: $colorTextInverse;
      font-size: $fontSizeRegular;
      line-height: 1.3;
      padding: 0 2rem;
      word-break: break-all;
      margin-top: 0.5rem;
      line-break: anywhere;
    }

    &.align-left {
      text-align: left;
    }

    &.align-center {
      text-align: center;
    }

    &.align-right {
      text-align: right;
    }
  }

  &.theme-blue {
    .widget-form-header {
      background-image: url("./../../images/form_internal_bg_blue.png");
    }

    .form-design-container {
      height: calc(100% - 180px);
    }
  }

  &.theme-purple {
    .widget-form-header {
      background-image: url("./../../images/form_internal_bg_purple.png");
    }

    .form-design-container {
      height: calc(100% - 180px);
    }
  }

  &.theme-gov {
    .widget-form-header {
      background-image: url("./../../images/form_internal_bg_gov.png");
    }

    .form-design-container {
      height: calc(100% - 180px);
    }
  }

  .widget-form-list {
    min-height: 100%;
    padding-top: 1px;

    li.ghost {
      @include ghost;
    }
  }

  &.pc {
    max-width: $maxFormPageWidth;
    min-width: $minFormPageWidth;
    margin: auto;
    border: 0;
    background: $bgColorPrimary;
    border-radius: 6px;
    box-shadow: $widget-form-container-shadow;
    top: $widget-form-container-space;
    left: $widget-form-container-space;
    right: $widget-form-container-space;
    bottom: $widget-form-container-space;
  }

  &.mobile {
    width: $minFormPageWidth;
    margin: auto;
    border: 0;
    background: $bgColorPrimary;
    border-radius: 1rem;
    box-shadow: $widget-form-container-shadow;
    top: $widget-form-container-space;
    left: $widget-form-container-space;
    right: $widget-form-container-space;
    bottom: $widget-form-container-space;

    & > .widget-form-wrapper {
      width: 100% !important;
    }

    .widget-form-header {
      background-size: auto 80px;
      background-position: top;
      border-bottom: 1px solid $borderColorLighter;
      height: auto !important;

      .widget-form-title {
        color: $colorTextInverse;
        font-size: $fontSizeExtraLarge;
        height: 80px;
        line-height: 1.1;
        padding: 0 1.5rem;
        display: flex;
        align-items: center;
      }

      .widget-form-sub-title {
        color: $colorTextInfo;
        font-size: $fontSizeSmall;
        line-height: 1.2;
        padding: 0 1.5rem;
        margin-top: 0.9rem;
        margin-bottom: 0.9rem;
      }

      &.align-left {
        .widget-form-title {
          justify-content: flex-start;
        }
      }

      &.align-center {
        .widget-form-title {
          justify-content: center;
        }
      }

      &.align-right {
        .widget-form-title {
          justify-content: flex-end;
        }
      }
    }
  }

  &.pad {
    width: $screen_xs_max;
    margin: auto;
    border: 0;
    background: $bgColorPrimary;
    border-radius: 6px;
    box-shadow: $widget-form-container-shadow;
    top: $widget-form-container-space;
    left: $widget-form-container-space;
    right: $widget-form-container-space;
    bottom: $widget-form-container-space;
  }
  .form-option-load-failed {
    border: 1px solid $colorDangerLighten;
    background: $colorDangerLighten;
    border-radius: $radiusRegular;
    color: $colorDangerActive;
    padding: 0 1rem;
    margin: 2px 0;
    height: 2rem;
    line-height: 2rem;
    overflow: hidden;

    & > .el-button {
      float: right;
      color: $colorTextPrimary;
    }
  }
}
